<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>点击修改元素属性</title>
</head>
<body>
    <input type="button" value="点击效果" id="btn">
    <img src="" alt="点击后显示图片" id="pic">

    <script>
    var obj = document.getElementById("btn");
    var obj1 = document.getElementById("pic");

    obj.onclick = function(){
        obj1.src = "images/liuyan.jpg";
        obj1.width = "300";
        obj1.height = "400";
    }
    
    </script>
</body>
</html>